home *** CD-ROM | disk | FTP | other *** search
Java Source | 2000-12-31 | 1.7 KB | 58 lines |
- import vrml.*;
- import vrml.field.*;
- import vrml.node.*;
-
- /* âgâOâïüEâXâCâbâ`ùpé╠éiéüéûéüé╔éµéΘâXâNâèâvâgɺîΣ */
- public class Switch extends Script {
- private SFBool onOff_changed;
- private SFBool areaOver;
- private SFBool status;
-
- /* Åëè·ë╗âüâ\âbâh */
- public void initialize() {
- onOff_changed
- =(SFBool) getEventOut("onOff_changed");
- areaOver=(SFBool)getField("areaOver");
- status=(SFBool)getField("status");
- }
-
- /* âCâxâôâgÅêù¥âüâ\âbâh */
- public void processEvents(int count,Event[] es) {
- int i;
- for(i=0;i<count;i++){
- if(es[i].getName().equals("set_onOff")
- ==true){
- set_onOff((ConstSFBool)es[i].getValue());
- }
- else if(es[i].getName().equals("set_throw")
- ==true){
- set_throw((ConstSFBool)es[i].getValue());
- }
- }
- }
-
- /* éôéàéöüQéÅéÄénéåéåâüâ\âbâhü@*/
- private void set_onOff(ConstSFBool v){
- boolean value=v.getValue();
- if(value==false && areaOver.getValue()==true){
- if(status.getValue()==false){
- status.setValue(true);
- }
- else{
- status.setValue(false);
- }
- onOff_changed.setValue(status.getValue());
- }
- }
-
- /*ü@éôéàéöüQéöéêéÆéÅéùâüâ\âbâhü@*/
- private void set_throw(ConstSFBool v){
- boolean value=v.getValue();
- if(value==false){
- areaOver.setValue(false);
- }
- else{
- areaOver.setValue(true);
- }
- }
- }